package uaiContacts.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Droog
 */
@Entity
@Table(name = "tb_turma_ebd", catalog = "sistema_ipi", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TurmaEbd.findAll", query = "SELECT t FROM TurmaEbd t"),
    @NamedQuery(name = "TurmaEbd.findByIdTurma", query = "SELECT t FROM TurmaEbd t WHERE t.idTurma = :idTurma"),
    @NamedQuery(name = "TurmaEbd.findByTurma", query = "SELECT t FROM TurmaEbd t WHERE t.turma = :turma"),
    @NamedQuery(name = "TurmaEbd.findByIdprofessor", query = "SELECT t FROM TurmaEbd t WHERE t.idprofessor = :idprofessor"),
    @NamedQuery(name = "TurmaEbd.findByHrInicio", query = "SELECT t FROM TurmaEbd t WHERE t.hrInicio = :hrInicio"),
    @NamedQuery(name = "TurmaEbd.findByHrFim", query = "SELECT t FROM TurmaEbd t WHERE t.hrFim = :hrFim")})
public class TurmaEbd implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_turma", nullable = false)
    private Integer idTurma;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(nullable = false, length = 40)
    private String turma;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private int idprofessor;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hr_inicio", nullable = false)
    @Temporal(TemporalType.TIME)
    private Date hrInicio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hr_fim", nullable = false)
    @Temporal(TemporalType.TIME)
    private Date hrFim;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTurma")
    private List<Ebd> ebdList;

    public TurmaEbd() {
    }

    public TurmaEbd(Integer idTurma) {
        this.idTurma = idTurma;
    }

    public TurmaEbd(Integer idTurma, String turma, int idprofessor, Date hrInicio, Date hrFim) {
        this.idTurma = idTurma;
        this.turma = turma;
        this.idprofessor = idprofessor;
        this.hrInicio = hrInicio;
        this.hrFim = hrFim;
    }

    public Integer getIdTurma() {
        return idTurma;
    }

    public void setIdTurma(Integer idTurma) {
        this.idTurma = idTurma;
    }

    public String getTurma() {
        return turma;
    }

    public void setTurma(String turma) {
        this.turma = turma;
    }

    public int getIdprofessor() {
        return idprofessor;
    }

    public void setIdprofessor(int idprofessor) {
        this.idprofessor = idprofessor;
    }

    public Date getHrInicio() {
        return hrInicio;
    }

    public void setHrInicio(Date hrInicio) {
        this.hrInicio = hrInicio;
    }

    public Date getHrFim() {
        return hrFim;
    }

    public void setHrFim(Date hrFim) {
        this.hrFim = hrFim;
    }

    @XmlTransient
    public List<Ebd> getEbdList() {
        return ebdList;
    }

    public void setEbdList(List<Ebd> ebdList) {
        this.ebdList = ebdList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTurma != null ? idTurma.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TurmaEbd)) {
            return false;
        }
        TurmaEbd other = (TurmaEbd) object;
        if ((this.idTurma == null && other.idTurma != null) || (this.idTurma != null && !this.idTurma.equals(other.idTurma))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.TurmaEbd[ idTurma=" + idTurma + " ]";
    }
    
}